package xkp.lesson4.ui;

import javax.swing.*;
import java.awt.*;

public class MainContent extends JFrame {
    public MainContent(){
        //设置窗体尺寸
        this.setSize(1000,600);
        //禁止改变大小
        this.setResizable(false);
        this.setTitle("登录");
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        BorderLayout borderLayout = new BorderLayout();
        this.setLayout(borderLayout);
        //JPanel相当于(块)div,是用于给JFrame分区域
        JPanel northPanel = new JPanel();
        JLabel jLabel = new JLabel("North");
        northPanel.add(jLabel);
        northPanel.setBackground(Color.BLUE);
        this.add(northPanel,BorderLayout.NORTH);
        JPanel southPanel = new JPanel();
        southPanel.setBackground(Color.red);
        this.add(southPanel,BorderLayout.SOUTH);
        JPanel westPanel = new JPanel();
        this.add(westPanel,BorderLayout.WEST);
        JPanel eastPanel = new JPanel();
        this.add(eastPanel,BorderLayout.EAST);
        JPanel centerPanel = new JPanel();
        centerPanel.setBackground(Color.YELLOW);
        this.add(centerPanel,BorderLayout.CENTER);


        this.setVisible(true);
    }
}
